package com.bw.Threads.pattern_LinkedBlockingQueue.pattern;

import java.util.concurrent.LinkedBlockingDeque;

public class Producer implements Runnable{

    private LinkedBlockingDeque<String> backet;

    public Producer(LinkedBlockingDeque<String> backet) {
        this.backet = backet;
    }

    @Override
    public void run() {
        while (true){
            try {
                backet.put("包子！");//阻塞队列中put是往队列中加值
                System.out.println(Thread.currentThread().getName() + "生产一个，" + backet.size());
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
    }
}
